home *** CD-ROM | disk | FTP | other *** search
/ Fritz: All Fritz / All Fritz.zip / All Fritz / FILES / PROGNG_C / DBTOOLC.LZH / SOURCE.ARC / RSTWINDO.C < prev    next >
Text File  |  1985-06-11  |  943b  |  29 lines

  1.  
  2. /* restore a screen window from memory */
  3. rstwindo(uplr,uplc,lrr,lrc,buffer)
  4. int uplc,uplr; /* upper left column and row coordinates */
  5. int lrc,lrr;   /* lower right corner (col and row) */
  6. char *buffer;  /* pointer to buffer area to restore screen */
  7. {
  8.   int length;  /* length of each row to restore */
  9.   int i;       /* counter fro for loop */
  10.   int actpage,mode,cols; /* current screen attributes */
  11.  
  12.   getscmod(&mode,&cols,&actpage);
  13.  
  14.   if (mode > 3 && mode < 7)    /* graphics modes are not supported */
  15.     return(-1);
  16.  
  17.   length = lrc - uplc + 1;   /* length= right corner - left corner */
  18.   if (length == cols){         /* restoring contiguous area */
  19.     memtoscr( (lrr-uplr+1) * length, ((uplr * cols) + uplc)*2, buffer);
  20.                  /*    offset into screen memory, length in bytes  */
  21.   }else{
  22.     for(i=uplr;i<=lrr;i++){
  23.  
  24.         memtoscr( length, ((i * cols)+uplc)*2,buffer);
  25.         buffer += (length*2);
  26.     }
  27.   }
  28. }
  29.